<template>
  <div class="select-block" @click="handleClick">
    <div class="select-text">{{ text }}</div>
    <div class="select-arrow">
      <img src="/images/down.png" />
    </div>
  </div>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue';

// 定义 props
const props = defineProps({
  text: {
    type: String,
    required: true,
  },
});

// 定义 emits
const emit = defineEmits(['click']);

// 点击事件处理函数
const handleClick = () => {
  emit('click');
};
</script>

<style scoped>
.select-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  background-color: white;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.select-block:hover {
  background-color: #e0e0e0;
}

.select-text {
  font-size: 16PX;
  color: #333;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.select-arrow {
  display: flex;
  align-items: center;
}

.arrow-icon {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid #999;
  margin-left: 8px;
}
</style>